package com.woniuxy.dao;

import com.woniuxy.controller.info.DefectStateIdAndState;
import com.woniuxy.controller.info.DefectstateNamesInfo;
import com.woniuxy.model.Defectseverity;
import com.woniuxy.model.Defectstate;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 马世亮
 * @since 2022-02-15
 */
public interface DefectstateDao extends BaseMapper<Defectstate> {

    @Select("SELECT * FROM t_defectstate where defectState_delect=0 ORDER BY defectState_num")
    List<Defectstate> selectAll();

    @Select("SELECT * FROM t_defectstate WHERE defectState_sign='新建' AND defectState_delect=0 AND defectState_state=1")
    List<DefectstateNamesInfo> selectInitState();

    @Select("SELECT defectState_id,defectState_num,defectState_name FROM t_defectstate WHERE defectState_state=1 AND defectState_delect=0 ORDER BY defectState_num")
    List<DefectStateIdAndState> selectStateIsOk();

    @Select("SELECT * FROM t_defectstate WHERE defectState_state=1 ORDER BY defectState_num LIMIT 1,1")
    Defectstate selectScendState();

    @Select("SELECT defectState_id,defectState_num,defectState_name FROM t_defectstate WHERE defectState_state=1 AND defectState_sign IN ('处理','完成') AND defectState_delect=0 ")
    List<DefectStateIdAndState> selectNoInitState();

    @Select("SELECT defectState_id FROM t_defectstate WHERE defectState_sign='新建' AND defectState_delect=0 AND defectState_state=1")
    List<Integer> selectInitStateId();

    @Select("SELECT defectState_id,defectState_num,defectState_name FROM t_defectstate WHERE defectState_sign='分配' AND defectState_delect=0 AND defectState_state=1")
    List<DefectstateNamesInfo> selectChoiceStates();
}
